package com.cs496.finalproject;

import java.io.IOException;
import java.util.List;

import javax.jdo.PersistenceManager;
import javax.jdo.Query;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;



public class CronJob1 extends HttpServlet{

	@SuppressWarnings("unchecked")
	@Override
	public void doGet(HttpServletRequest request, HttpServletResponse response)
			throws IOException {
	
		PersistenceManager pm = PMF.getPMF().getPersistenceManager();
		try {
			long current = System.currentTimeMillis();
			
			Query query = pm.newQuery(Item.class); 
		    List<Item> allItems = (List<Item>)query.execute();
		    for (Item obj : allItems)
		    {
		    	
					pm.deletePersistent(obj);
		    	
	
		   }
		}finally {
				pm.close();		
		}
		
	

}
	
}
